Imports SERPS.ICdataLogic
Imports System.Data
Imports System.Data.SqlClient
Public Class frmProductSalesReport
    Inherits System.Windows.Forms.Form
    Dim icpEdit As ICproductsEdit

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents dgProduct As System.Windows.Forms.DataGrid
    Friend WithEvents ttHelp As System.Windows.Forms.ToolTip
    Friend WithEvents tbToDate As System.Windows.Forms.DateTimePicker
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents tbFromDate As System.Windows.Forms.DateTimePicker
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents rbDate As System.Windows.Forms.RadioButton
    Friend WithEvents rbUTD As System.Windows.Forms.RadioButton
    Friend WithEvents rbToday As System.Windows.Forms.RadioButton
    Friend WithEvents rbWeek As System.Windows.Forms.RadioButton
    Friend WithEvents rbMonth As System.Windows.Forms.RadioButton
    Friend WithEvents rbMonth5 As System.Windows.Forms.RadioButton
    Friend WithEvents rbMonth6 As System.Windows.Forms.RadioButton
    Friend WithEvents rbMonth7 As System.Windows.Forms.RadioButton
    Friend WithEvents rbMonth10 As System.Windows.Forms.RadioButton
    Friend WithEvents rbMonth9 As System.Windows.Forms.RadioButton
    Friend WithEvents rbMonth8 As System.Windows.Forms.RadioButton
    Friend WithEvents rbMonth4 As System.Windows.Forms.RadioButton
    Friend WithEvents rbMonth3 As System.Windows.Forms.RadioButton
    Friend WithEvents rbMonth2 As System.Windows.Forms.RadioButton
    Friend WithEvents rbMonth1 As System.Windows.Forms.RadioButton
    Friend WithEvents rbMonth12 As System.Windows.Forms.RadioButton
    Friend WithEvents rbMonth11 As System.Windows.Forms.RadioButton
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents lblpYear As System.Windows.Forms.Label
    Friend WithEvents label4 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents tbTqty As System.Windows.Forms.TextBox
    Friend WithEvents tbTsale As System.Windows.Forms.TextBox
    Friend WithEvents tbTdis As System.Windows.Forms.TextBox
    Friend WithEvents tbTNet As System.Windows.Forms.TextBox
    Friend WithEvents crICproductSales1 As crICproductSales
    Friend WithEvents GroupPanel1 As DevComponents.DotNetBar.Controls.GroupPanel
    Friend WithEvents cmbShowroom As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents cmdPrint As DevComponents.DotNetBar.ButtonX
    Friend WithEvents cmdRefresh As DevComponents.DotNetBar.ButtonX
    Friend WithEvents cmdExit As DevComponents.DotNetBar.ButtonX
    Friend WithEvents cmbDept As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents cmbBrand As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents cmbManuf As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents Label9 As System.Windows.Forms.Label
    Friend WithEvents cmbCate As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents Label10 As System.Windows.Forms.Label
    Friend WithEvents cmbSubCate As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents Label11 As System.Windows.Forms.Label
    Friend WithEvents cmbSubSubCate As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents cmbYear As DevComponents.DotNetBar.Controls.ComboBoxEx
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Me.dgProduct = New System.Windows.Forms.DataGrid()
        Me.ttHelp = New System.Windows.Forms.ToolTip(Me.components)
        Me.tbToDate = New System.Windows.Forms.DateTimePicker()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.tbFromDate = New System.Windows.Forms.DateTimePicker()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.rbDate = New System.Windows.Forms.RadioButton()
        Me.rbUTD = New System.Windows.Forms.RadioButton()
        Me.rbToday = New System.Windows.Forms.RadioButton()
        Me.rbWeek = New System.Windows.Forms.RadioButton()
        Me.rbMonth = New System.Windows.Forms.RadioButton()
        Me.rbMonth5 = New System.Windows.Forms.RadioButton()
        Me.rbMonth6 = New System.Windows.Forms.RadioButton()
        Me.rbMonth7 = New System.Windows.Forms.RadioButton()
        Me.rbMonth10 = New System.Windows.Forms.RadioButton()
        Me.rbMonth9 = New System.Windows.Forms.RadioButton()
        Me.rbMonth8 = New System.Windows.Forms.RadioButton()
        Me.rbMonth4 = New System.Windows.Forms.RadioButton()
        Me.rbMonth3 = New System.Windows.Forms.RadioButton()
        Me.rbMonth2 = New System.Windows.Forms.RadioButton()
        Me.rbMonth1 = New System.Windows.Forms.RadioButton()
        Me.rbMonth12 = New System.Windows.Forms.RadioButton()
        Me.rbMonth11 = New System.Windows.Forms.RadioButton()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.lblpYear = New System.Windows.Forms.Label()
        Me.label4 = New System.Windows.Forms.Label()
        Me.Label5 = New System.Windows.Forms.Label()
        Me.tbTqty = New System.Windows.Forms.TextBox()
        Me.tbTsale = New System.Windows.Forms.TextBox()
        Me.tbTdis = New System.Windows.Forms.TextBox()
        Me.tbTNet = New System.Windows.Forms.TextBox()
        Me.GroupPanel1 = New DevComponents.DotNetBar.Controls.GroupPanel()
        Me.cmbShowroom = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.cmdPrint = New DevComponents.DotNetBar.ButtonX()
        Me.cmdRefresh = New DevComponents.DotNetBar.ButtonX()
        Me.cmdExit = New DevComponents.DotNetBar.ButtonX()
        Me.cmbYear = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.cmbDept = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.Label6 = New System.Windows.Forms.Label()
        Me.Label7 = New System.Windows.Forms.Label()
        Me.cmbBrand = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.Label8 = New System.Windows.Forms.Label()
        Me.cmbManuf = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.Label9 = New System.Windows.Forms.Label()
        Me.cmbCate = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.Label10 = New System.Windows.Forms.Label()
        Me.cmbSubCate = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.Label11 = New System.Windows.Forms.Label()
        Me.cmbSubSubCate = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.GroupBox2 = New System.Windows.Forms.GroupBox()
        CType(Me.dgProduct, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.GroupPanel1.SuspendLayout()
        Me.GroupBox1.SuspendLayout()
        Me.GroupBox2.SuspendLayout()
        Me.SuspendLayout()
        '
        'dgProduct
        '
        Me.dgProduct.BackColor = System.Drawing.Color.AliceBlue
        Me.dgProduct.BackgroundColor = System.Drawing.Color.AliceBlue
        Me.dgProduct.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.dgProduct.CaptionVisible = False
        Me.dgProduct.DataMember = ""
        Me.dgProduct.HeaderBackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(128, Byte), Integer))
        Me.dgProduct.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.dgProduct.Location = New System.Drawing.Point(19, 206)
        Me.dgProduct.Name = "dgProduct"
        Me.dgProduct.ReadOnly = True
        Me.dgProduct.Size = New System.Drawing.Size(986, 383)
        Me.dgProduct.TabIndex = 13
        Me.ttHelp.SetToolTip(Me.dgProduct, "Click on Column Header to Sort.  Click in grid to select product")
        '
        'tbToDate
        '
        Me.tbToDate.Format = System.Windows.Forms.DateTimePickerFormat.[Short]
        Me.tbToDate.Location = New System.Drawing.Point(211, 101)
        Me.tbToDate.Name = "tbToDate"
        Me.tbToDate.Size = New System.Drawing.Size(91, 26)
        Me.tbToDate.TabIndex = 160
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.BackColor = System.Drawing.Color.Transparent
        Me.Label2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label2.Location = New System.Drawing.Point(212, 80)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(54, 18)
        Me.Label2.TabIndex = 159
        Me.Label2.Text = "To Date"
        '
        'tbFromDate
        '
        Me.tbFromDate.Format = System.Windows.Forms.DateTimePickerFormat.[Short]
        Me.tbFromDate.Location = New System.Drawing.Point(119, 125)
        Me.tbFromDate.Name = "tbFromDate"
        Me.tbFromDate.Size = New System.Drawing.Size(91, 26)
        Me.tbFromDate.TabIndex = 158
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.BackColor = System.Drawing.Color.Transparent
        Me.Label1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label1.Location = New System.Drawing.Point(116, 80)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(72, 18)
        Me.Label1.TabIndex = 157
        Me.Label1.Text = "From Date"
        '
        'rbDate
        '
        Me.rbDate.AutoSize = True
        Me.rbDate.BackColor = System.Drawing.Color.Transparent
        Me.rbDate.Checked = True
        Me.rbDate.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbDate.Location = New System.Drawing.Point(16, 98)
        Me.rbDate.Name = "rbDate"
        Me.rbDate.Size = New System.Drawing.Size(96, 22)
        Me.rbDate.TabIndex = 161
        Me.rbDate.TabStop = True
        Me.rbDate.Text = "Date Range"
        Me.rbDate.UseVisualStyleBackColor = False
        '
        'rbUTD
        '
        Me.rbUTD.AutoSize = True
        Me.rbUTD.BackColor = System.Drawing.Color.Transparent
        Me.rbUTD.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbUTD.Location = New System.Drawing.Point(4, 16)
        Me.rbUTD.Name = "rbUTD"
        Me.rbUTD.Size = New System.Drawing.Size(106, 22)
        Me.rbUTD.TabIndex = 162
        Me.rbUTD.Text = "All Sales UTD"
        Me.rbUTD.UseVisualStyleBackColor = False
        '
        'rbToday
        '
        Me.rbToday.AutoSize = True
        Me.rbToday.BackColor = System.Drawing.Color.Transparent
        Me.rbToday.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbToday.Location = New System.Drawing.Point(115, 16)
        Me.rbToday.Name = "rbToday"
        Me.rbToday.Size = New System.Drawing.Size(106, 22)
        Me.rbToday.TabIndex = 163
        Me.rbToday.Text = "Today's Sales"
        Me.rbToday.UseVisualStyleBackColor = False
        '
        'rbWeek
        '
        Me.rbWeek.AutoSize = True
        Me.rbWeek.BackColor = System.Drawing.Color.Transparent
        Me.rbWeek.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbWeek.Location = New System.Drawing.Point(229, 16)
        Me.rbWeek.Name = "rbWeek"
        Me.rbWeek.Size = New System.Drawing.Size(89, 22)
        Me.rbWeek.TabIndex = 164
        Me.rbWeek.Text = "This Week"
        Me.rbWeek.UseVisualStyleBackColor = False
        '
        'rbMonth
        '
        Me.rbMonth.AutoSize = True
        Me.rbMonth.BackColor = System.Drawing.Color.Transparent
        Me.rbMonth.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbMonth.Location = New System.Drawing.Point(325, 16)
        Me.rbMonth.Name = "rbMonth"
        Me.rbMonth.Size = New System.Drawing.Size(95, 22)
        Me.rbMonth.TabIndex = 165
        Me.rbMonth.Text = "This Month"
        Me.rbMonth.UseVisualStyleBackColor = False
        '
        'rbMonth5
        '
        Me.rbMonth5.AutoSize = True
        Me.rbMonth5.BackColor = System.Drawing.Color.Transparent
        Me.rbMonth5.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbMonth5.Location = New System.Drawing.Point(6, 18)
        Me.rbMonth5.Name = "rbMonth5"
        Me.rbMonth5.Size = New System.Drawing.Size(52, 22)
        Me.rbMonth5.TabIndex = 166
        Me.rbMonth5.Text = "May"
        Me.rbMonth5.UseVisualStyleBackColor = False
        '
        'rbMonth6
        '
        Me.rbMonth6.AutoSize = True
        Me.rbMonth6.BackColor = System.Drawing.Color.Transparent
        Me.rbMonth6.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbMonth6.Location = New System.Drawing.Point(63, 18)
        Me.rbMonth6.Name = "rbMonth6"
        Me.rbMonth6.Size = New System.Drawing.Size(55, 22)
        Me.rbMonth6.TabIndex = 167
        Me.rbMonth6.Text = "June"
        Me.rbMonth6.UseVisualStyleBackColor = False
        '
        'rbMonth7
        '
        Me.rbMonth7.AutoSize = True
        Me.rbMonth7.BackColor = System.Drawing.Color.Transparent
        Me.rbMonth7.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbMonth7.Location = New System.Drawing.Point(125, 18)
        Me.rbMonth7.Name = "rbMonth7"
        Me.rbMonth7.Size = New System.Drawing.Size(50, 22)
        Me.rbMonth7.TabIndex = 168
        Me.rbMonth7.Text = "July"
        Me.rbMonth7.UseVisualStyleBackColor = False
        '
        'rbMonth10
        '
        Me.rbMonth10.AutoSize = True
        Me.rbMonth10.BackColor = System.Drawing.Color.Transparent
        Me.rbMonth10.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbMonth10.Location = New System.Drawing.Point(358, 18)
        Me.rbMonth10.Name = "rbMonth10"
        Me.rbMonth10.Size = New System.Drawing.Size(76, 22)
        Me.rbMonth10.TabIndex = 171
        Me.rbMonth10.Text = "October"
        Me.rbMonth10.UseVisualStyleBackColor = False
        '
        'rbMonth9
        '
        Me.rbMonth9.AutoSize = True
        Me.rbMonth9.BackColor = System.Drawing.Color.Transparent
        Me.rbMonth9.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbMonth9.Location = New System.Drawing.Point(257, 18)
        Me.rbMonth9.Name = "rbMonth9"
        Me.rbMonth9.Size = New System.Drawing.Size(95, 22)
        Me.rbMonth9.TabIndex = 170
        Me.rbMonth9.Text = "September"
        Me.rbMonth9.UseVisualStyleBackColor = False
        '
        'rbMonth8
        '
        Me.rbMonth8.AutoSize = True
        Me.rbMonth8.BackColor = System.Drawing.Color.Transparent
        Me.rbMonth8.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbMonth8.Location = New System.Drawing.Point(182, 18)
        Me.rbMonth8.Name = "rbMonth8"
        Me.rbMonth8.Size = New System.Drawing.Size(69, 22)
        Me.rbMonth8.TabIndex = 169
        Me.rbMonth8.Text = "August"
        Me.rbMonth8.UseVisualStyleBackColor = False
        '
        'rbMonth4
        '
        Me.rbMonth4.AutoSize = True
        Me.rbMonth4.BackColor = System.Drawing.Color.Transparent
        Me.rbMonth4.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbMonth4.Location = New System.Drawing.Point(870, 18)
        Me.rbMonth4.Name = "rbMonth4"
        Me.rbMonth4.Size = New System.Drawing.Size(56, 22)
        Me.rbMonth4.TabIndex = 177
        Me.rbMonth4.Text = "April"
        Me.rbMonth4.UseVisualStyleBackColor = False
        '
        'rbMonth3
        '
        Me.rbMonth3.AutoSize = True
        Me.rbMonth3.BackColor = System.Drawing.Color.Transparent
        Me.rbMonth3.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbMonth3.Location = New System.Drawing.Point(800, 18)
        Me.rbMonth3.Name = "rbMonth3"
        Me.rbMonth3.Size = New System.Drawing.Size(64, 22)
        Me.rbMonth3.TabIndex = 176
        Me.rbMonth3.Text = "March"
        Me.rbMonth3.UseVisualStyleBackColor = False
        '
        'rbMonth2
        '
        Me.rbMonth2.AutoSize = True
        Me.rbMonth2.BackColor = System.Drawing.Color.Transparent
        Me.rbMonth2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbMonth2.Location = New System.Drawing.Point(713, 18)
        Me.rbMonth2.Name = "rbMonth2"
        Me.rbMonth2.Size = New System.Drawing.Size(81, 22)
        Me.rbMonth2.TabIndex = 175
        Me.rbMonth2.Text = "February"
        Me.rbMonth2.UseVisualStyleBackColor = False
        '
        'rbMonth1
        '
        Me.rbMonth1.AutoSize = True
        Me.rbMonth1.BackColor = System.Drawing.Color.Transparent
        Me.rbMonth1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbMonth1.Location = New System.Drawing.Point(634, 18)
        Me.rbMonth1.Name = "rbMonth1"
        Me.rbMonth1.Size = New System.Drawing.Size(73, 22)
        Me.rbMonth1.TabIndex = 174
        Me.rbMonth1.Text = "January"
        Me.rbMonth1.UseVisualStyleBackColor = False
        '
        'rbMonth12
        '
        Me.rbMonth12.AutoSize = True
        Me.rbMonth12.BackColor = System.Drawing.Color.Transparent
        Me.rbMonth12.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbMonth12.Location = New System.Drawing.Point(538, 18)
        Me.rbMonth12.Name = "rbMonth12"
        Me.rbMonth12.Size = New System.Drawing.Size(90, 22)
        Me.rbMonth12.TabIndex = 173
        Me.rbMonth12.Text = "December"
        Me.rbMonth12.UseVisualStyleBackColor = False
        '
        'rbMonth11
        '
        Me.rbMonth11.AutoSize = True
        Me.rbMonth11.BackColor = System.Drawing.Color.Transparent
        Me.rbMonth11.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbMonth11.Location = New System.Drawing.Point(440, 18)
        Me.rbMonth11.Name = "rbMonth11"
        Me.rbMonth11.Size = New System.Drawing.Size(92, 22)
        Me.rbMonth11.TabIndex = 172
        Me.rbMonth11.Text = "November"
        Me.rbMonth11.UseVisualStyleBackColor = False
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.BackColor = System.Drawing.Color.Transparent
        Me.Label3.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label3.Location = New System.Drawing.Point(312, 81)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(74, 18)
        Me.Label3.TabIndex = 178
        Me.Label3.Text = "Fiscal Year "
        '
        'lblpYear
        '
        Me.lblpYear.AutoSize = True
        Me.lblpYear.BackColor = System.Drawing.Color.Transparent
        Me.lblpYear.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.lblpYear.Location = New System.Drawing.Point(959, 155)
        Me.lblpYear.Name = "lblpYear"
        Me.lblpYear.Size = New System.Drawing.Size(43, 18)
        Me.lblpYear.TabIndex = 180
        Me.lblpYear.Text = "pyear"
        '
        'label4
        '
        Me.label4.AutoSize = True
        Me.label4.BackColor = System.Drawing.Color.Transparent
        Me.label4.Location = New System.Drawing.Point(406, 82)
        Me.label4.Name = "label4"
        Me.label4.Size = New System.Drawing.Size(75, 18)
        Me.label4.TabIndex = 182
        Me.label4.Text = "Showroom"
        '
        'Label5
        '
        Me.Label5.AutoSize = True
        Me.Label5.BackColor = System.Drawing.Color.Transparent
        Me.Label5.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label5.Location = New System.Drawing.Point(307, 584)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(78, 18)
        Me.Label5.TabIndex = 183
        Me.Label5.Text = "Grand Total"
        '
        'tbTqty
        '
        Me.tbTqty.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.tbTqty.Location = New System.Drawing.Point(391, 584)
        Me.tbTqty.Name = "tbTqty"
        Me.tbTqty.Size = New System.Drawing.Size(79, 26)
        Me.tbTqty.TabIndex = 184
        Me.tbTqty.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'tbTsale
        '
        Me.tbTsale.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.tbTsale.Location = New System.Drawing.Point(472, 584)
        Me.tbTsale.Name = "tbTsale"
        Me.tbTsale.Size = New System.Drawing.Size(78, 26)
        Me.tbTsale.TabIndex = 185
        Me.tbTsale.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'tbTdis
        '
        Me.tbTdis.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.tbTdis.Location = New System.Drawing.Point(551, 584)
        Me.tbTdis.Name = "tbTdis"
        Me.tbTdis.Size = New System.Drawing.Size(87, 26)
        Me.tbTdis.TabIndex = 186
        Me.tbTdis.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'tbTNet
        '
        Me.tbTNet.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.tbTNet.Location = New System.Drawing.Point(640, 584)
        Me.tbTNet.Name = "tbTNet"
        Me.tbTNet.Size = New System.Drawing.Size(83, 26)
        Me.tbTNet.TabIndex = 187
        Me.tbTNet.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'GroupPanel1
        '
        Me.GroupPanel1.CanvasColor = System.Drawing.SystemColors.Control
        Me.GroupPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007
        Me.GroupPanel1.Controls.Add(Me.cmdPrint)
        Me.GroupPanel1.Controls.Add(Me.GroupBox2)
        Me.GroupPanel1.Controls.Add(Me.cmdRefresh)
        Me.GroupPanel1.Controls.Add(Me.GroupBox1)
        Me.GroupPanel1.Controls.Add(Me.cmdExit)
        Me.GroupPanel1.Controls.Add(Me.lblpYear)
        Me.GroupPanel1.Controls.Add(Me.Label1)
        Me.GroupPanel1.Controls.Add(Me.Label2)
        Me.GroupPanel1.Controls.Add(Me.tbToDate)
        Me.GroupPanel1.Controls.Add(Me.tbTNet)
        Me.GroupPanel1.Controls.Add(Me.tbTdis)
        Me.GroupPanel1.Controls.Add(Me.Label3)
        Me.GroupPanel1.Controls.Add(Me.tbTsale)
        Me.GroupPanel1.Controls.Add(Me.Label6)
        Me.GroupPanel1.Controls.Add(Me.tbTqty)
        Me.GroupPanel1.Controls.Add(Me.Label7)
        Me.GroupPanel1.Controls.Add(Me.label4)
        Me.GroupPanel1.Controls.Add(Me.Label8)
        Me.GroupPanel1.Controls.Add(Me.Label9)
        Me.GroupPanel1.Controls.Add(Me.rbDate)
        Me.GroupPanel1.Controls.Add(Me.Label10)
        Me.GroupPanel1.Controls.Add(Me.Label11)
        Me.GroupPanel1.Controls.Add(Me.Label5)
        Me.GroupPanel1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.GroupPanel1.Location = New System.Drawing.Point(0, 0)
        Me.GroupPanel1.Name = "GroupPanel1"
        Me.GroupPanel1.Size = New System.Drawing.Size(1025, 646)
        '
        '
        '
        Me.GroupPanel1.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2
        Me.GroupPanel1.Style.BackColorGradientAngle = 90
        Me.GroupPanel1.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground
        Me.GroupPanel1.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderBottomWidth = 1
        Me.GroupPanel1.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder
        Me.GroupPanel1.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderLeftWidth = 1
        Me.GroupPanel1.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderRightWidth = 1
        Me.GroupPanel1.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderTopWidth = 1
        Me.GroupPanel1.Style.CornerDiameter = 4
        Me.GroupPanel1.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded
        Me.GroupPanel1.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center
        Me.GroupPanel1.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText
        Me.GroupPanel1.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near
        Me.GroupPanel1.TabIndex = 190
        Me.GroupPanel1.Text = "Sales Report - Product wise"
        '
        'cmbShowroom
        '
        Me.cmbShowroom.DisplayMember = "Text"
        Me.cmbShowroom.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbShowroom.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbShowroom.ItemHeight = 19
        Me.cmbShowroom.Location = New System.Drawing.Point(408, 126)
        Me.cmbShowroom.Name = "cmbShowroom"
        Me.cmbShowroom.Size = New System.Drawing.Size(159, 25)
        Me.cmbShowroom.TabIndex = 191
        '
        'cmdPrint
        '
        Me.cmdPrint.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdPrint.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdPrint.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdPrint.Location = New System.Drawing.Point(744, 583)
        Me.cmdPrint.Name = "cmdPrint"
        Me.cmdPrint.Size = New System.Drawing.Size(82, 27)
        Me.cmdPrint.TabIndex = 261
        Me.cmdPrint.Text = "Print"
        '
        'cmdRefresh
        '
        Me.cmdRefresh.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdRefresh.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdRefresh.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdRefresh.Location = New System.Drawing.Point(832, 583)
        Me.cmdRefresh.Name = "cmdRefresh"
        Me.cmdRefresh.Size = New System.Drawing.Size(82, 27)
        Me.cmdRefresh.TabIndex = 262
        Me.cmdRefresh.Text = "Refresh"
        '
        'cmdExit
        '
        Me.cmdExit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdExit.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdExit.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdExit.Location = New System.Drawing.Point(920, 583)
        Me.cmdExit.Name = "cmdExit"
        Me.cmdExit.Size = New System.Drawing.Size(82, 27)
        Me.cmdExit.TabIndex = 260
        Me.cmdExit.Text = "Exit"
        '
        'cmbYear
        '
        Me.cmbYear.DisplayMember = "Text"
        Me.cmbYear.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbYear.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbYear.ItemHeight = 19
        Me.cmbYear.Location = New System.Drawing.Point(314, 126)
        Me.cmbYear.Name = "cmbYear"
        Me.cmbYear.Size = New System.Drawing.Size(85, 25)
        Me.cmbYear.TabIndex = 191
        '
        'cmbDept
        '
        Me.cmbDept.DisplayMember = "Text"
        Me.cmbDept.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbDept.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbDept.ItemHeight = 19
        Me.cmbDept.Location = New System.Drawing.Point(19, 56)
        Me.cmbDept.Name = "cmbDept"
        Me.cmbDept.Size = New System.Drawing.Size(159, 25)
        Me.cmbDept.TabIndex = 191
        '
        'Label6
        '
        Me.Label6.AutoSize = True
        Me.Label6.BackColor = System.Drawing.Color.Transparent
        Me.Label6.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label6.Location = New System.Drawing.Point(16, 10)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(83, 18)
        Me.Label6.TabIndex = 178
        Me.Label6.Text = "Department"
        '
        'Label7
        '
        Me.Label7.AutoSize = True
        Me.Label7.BackColor = System.Drawing.Color.Transparent
        Me.Label7.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label7.Location = New System.Drawing.Point(182, 10)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(44, 18)
        Me.Label7.TabIndex = 178
        Me.Label7.Text = "Brand"
        '
        'cmbBrand
        '
        Me.cmbBrand.DisplayMember = "Text"
        Me.cmbBrand.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbBrand.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbBrand.ItemHeight = 19
        Me.cmbBrand.Location = New System.Drawing.Point(185, 56)
        Me.cmbBrand.Name = "cmbBrand"
        Me.cmbBrand.Size = New System.Drawing.Size(159, 25)
        Me.cmbBrand.TabIndex = 191
        '
        'Label8
        '
        Me.Label8.AutoSize = True
        Me.Label8.BackColor = System.Drawing.Color.Transparent
        Me.Label8.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label8.Location = New System.Drawing.Point(347, 10)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(92, 18)
        Me.Label8.TabIndex = 178
        Me.Label8.Text = "Manufacturer"
        '
        'cmbManuf
        '
        Me.cmbManuf.DisplayMember = "Text"
        Me.cmbManuf.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbManuf.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbManuf.ItemHeight = 19
        Me.cmbManuf.Location = New System.Drawing.Point(351, 56)
        Me.cmbManuf.Name = "cmbManuf"
        Me.cmbManuf.Size = New System.Drawing.Size(159, 25)
        Me.cmbManuf.TabIndex = 191
        '
        'Label9
        '
        Me.Label9.AutoSize = True
        Me.Label9.BackColor = System.Drawing.Color.Transparent
        Me.Label9.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label9.Location = New System.Drawing.Point(513, 10)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(63, 18)
        Me.Label9.TabIndex = 178
        Me.Label9.Text = "Category"
        '
        'cmbCate
        '
        Me.cmbCate.DisplayMember = "Text"
        Me.cmbCate.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbCate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbCate.ItemHeight = 19
        Me.cmbCate.Location = New System.Drawing.Point(516, 56)
        Me.cmbCate.Name = "cmbCate"
        Me.cmbCate.Size = New System.Drawing.Size(159, 25)
        Me.cmbCate.TabIndex = 191
        '
        'Label10
        '
        Me.Label10.AutoSize = True
        Me.Label10.BackColor = System.Drawing.Color.Transparent
        Me.Label10.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label10.Location = New System.Drawing.Point(678, 10)
        Me.Label10.Name = "Label10"
        Me.Label10.Size = New System.Drawing.Size(89, 18)
        Me.Label10.TabIndex = 178
        Me.Label10.Text = "Sub Category"
        '
        'cmbSubCate
        '
        Me.cmbSubCate.DisplayMember = "Text"
        Me.cmbSubCate.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbSubCate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbSubCate.ItemHeight = 19
        Me.cmbSubCate.Location = New System.Drawing.Point(681, 56)
        Me.cmbSubCate.Name = "cmbSubCate"
        Me.cmbSubCate.Size = New System.Drawing.Size(159, 25)
        Me.cmbSubCate.TabIndex = 191
        '
        'Label11
        '
        Me.Label11.AutoSize = True
        Me.Label11.BackColor = System.Drawing.Color.Transparent
        Me.Label11.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.Label11.Location = New System.Drawing.Point(840, 10)
        Me.Label11.Name = "Label11"
        Me.Label11.Size = New System.Drawing.Size(115, 18)
        Me.Label11.TabIndex = 178
        Me.Label11.Text = "Sub Sub Category"
        '
        'cmbSubSubCate
        '
        Me.cmbSubSubCate.DisplayMember = "Text"
        Me.cmbSubSubCate.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cmbSubSubCate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbSubSubCate.ItemHeight = 19
        Me.cmbSubSubCate.Location = New System.Drawing.Point(846, 56)
        Me.cmbSubSubCate.Name = "cmbSubSubCate"
        Me.cmbSubSubCate.Size = New System.Drawing.Size(159, 25)
        Me.cmbSubSubCate.TabIndex = 191
        '
        'GroupBox1
        '
        Me.GroupBox1.BackColor = System.Drawing.Color.Transparent
        Me.GroupBox1.Controls.Add(Me.rbUTD)
        Me.GroupBox1.Controls.Add(Me.rbToday)
        Me.GroupBox1.Controls.Add(Me.rbWeek)
        Me.GroupBox1.Controls.Add(Me.rbMonth)
        Me.GroupBox1.Location = New System.Drawing.Point(570, 83)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(431, 44)
        Me.GroupBox1.TabIndex = 263
        Me.GroupBox1.TabStop = False
        '
        'GroupBox2
        '
        Me.GroupBox2.BackColor = System.Drawing.Color.Transparent
        Me.GroupBox2.Controls.Add(Me.rbMonth5)
        Me.GroupBox2.Controls.Add(Me.rbMonth6)
        Me.GroupBox2.Controls.Add(Me.rbMonth7)
        Me.GroupBox2.Controls.Add(Me.rbMonth8)
        Me.GroupBox2.Controls.Add(Me.rbMonth9)
        Me.GroupBox2.Controls.Add(Me.rbMonth10)
        Me.GroupBox2.Controls.Add(Me.rbMonth11)
        Me.GroupBox2.Controls.Add(Me.rbMonth12)
        Me.GroupBox2.Controls.Add(Me.rbMonth1)
        Me.GroupBox2.Controls.Add(Me.rbMonth2)
        Me.GroupBox2.Controls.Add(Me.rbMonth3)
        Me.GroupBox2.Controls.Add(Me.rbMonth4)
        Me.GroupBox2.Location = New System.Drawing.Point(16, 129)
        Me.GroupBox2.Name = "GroupBox2"
        Me.GroupBox2.Size = New System.Drawing.Size(937, 47)
        Me.GroupBox2.TabIndex = 264
        Me.GroupBox2.TabStop = False
        '
        'frmProductSalesReport
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(7, 19)
        Me.BackColor = System.Drawing.SystemColors.ActiveCaption
        Me.ClientSize = New System.Drawing.Size(1025, 646)
        Me.ControlBox = False
        Me.Controls.Add(Me.cmbShowroom)
        Me.Controls.Add(Me.cmbYear)
        Me.Controls.Add(Me.cmbSubSubCate)
        Me.Controls.Add(Me.cmbSubCate)
        Me.Controls.Add(Me.cmbCate)
        Me.Controls.Add(Me.cmbManuf)
        Me.Controls.Add(Me.cmbBrand)
        Me.Controls.Add(Me.cmbDept)
        Me.Controls.Add(Me.tbFromDate)
        Me.Controls.Add(Me.dgProduct)
        Me.Controls.Add(Me.GroupPanel1)
        Me.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.Location = New System.Drawing.Point(30, 40)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "frmProductSalesReport"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        CType(Me.dgProduct, System.ComponentModel.ISupportInitialize).EndInit()
        Me.GroupPanel1.ResumeLayout(False)
        Me.GroupPanel1.PerformLayout()
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox1.PerformLayout()
        Me.GroupBox2.ResumeLayout(False)
        Me.GroupBox2.PerformLayout()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub ICproducts_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LoadGroupCombos(CompanyID)
        Dim cYr As Integer = Now.Year
        cmbYear.Items.Clear()
        cmbYear.Items.Add(cYr - 2)
        cmbYear.Items.Add(cYr - 1)
        cmbYear.Items.Add(cYr)
        cmbYear.Items.Add(cYr + 1)
        cmbYear.SelectedItem = Now.Year + 1

        If Now.Month <= 4 Then
            cmbYear.SelectedItem = Now.Year
            cmbYear.Text = (cYr).ToString()
            lblpYear.Text = cYr - 1
        Else
            cmbYear.SelectedItem = Now.Year + 1
            cmbYear.Text = (cYr + 1).ToString()
            lblpYear.Text = cYr.ToString()
        End If


        Dim ICdata As New ICdataLogic
        Dim ds As DataSet
        ds = ICdata.GetCompanyShowrooms(3)
        cmbShowroom.DataSource = ds.Tables(0)
        cmbShowroom.ValueMember = "DepartmentID"
        cmbShowroom.DisplayMember = "DepartmentName"
        cmbShowroom.SelectedValue = 0
        ICdata = Nothing
        '
    End Sub
    Private Sub LoadGroupCombos(ByVal CompanyCode As Integer)
        Dim ICdata As New ICdataLogic
        Dim ds As DataSet

        ds = ICdata.GetProductGroups(CompanyCode, 1)
        cmbDept.DataSource = ds.Tables(0)
        cmbDept.ValueMember = "GroupID"
        cmbDept.DisplayMember = "GroupName"
        cmbDept.SelectedValue = 0
        '
        ds = ICdata.GetProductGroups(CompanyCode, 2)
        cmbBrand.DataSource = ds.Tables(0)
        cmbBrand.ValueMember = "GroupID"
        cmbBrand.DisplayMember = "GroupName"
        cmbBrand.SelectedValue = 0
        '
        ds = ICdata.GetProductGroups(CompanyCode, 3)
        cmbManuf.DataSource = ds.Tables(0)
        cmbManuf.ValueMember = "GroupID"
        cmbManuf.DisplayMember = "GroupName"
        cmbManuf.SelectedValue = 0
        '
        ds = ICdata.GetProductGroups(CompanyCode, 4)
        cmbCate.DataSource = ds.Tables(0)
        cmbCate.ValueMember = "GroupID"
        cmbCate.DisplayMember = "GroupName"
        cmbCate.SelectedValue = 0
        '
        ds = ICdata.GetProductGroups(CompanyCode, 5)
        cmbSubCate.DataSource = ds.Tables(0)
        cmbSubCate.ValueMember = "GroupID"
        cmbSubCate.DisplayMember = "GroupName"
        cmbSubCate.SelectedValue = 0
        '
        ds = ICdata.GetProductGroups(CompanyCode, 6)
        cmbSubSubCate.DataSource = ds.Tables(0)
        cmbSubSubCate.ValueMember = "GroupID"
        cmbSubSubCate.DisplayMember = "GroupName"
        cmbSubSubCate.SelectedValue = 0
        '
        ICdata = Nothing
    End Sub
    Private Sub cmdRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRefresh.Click
        If DateTime.Parse(tbFromDate.Text) > DateTime.Parse(tbToDate.Text) Then
            MsgBox("End date is before Start date", MsgBoxStyle.Critical, "Inventory Manager")
            Exit Sub
        End If

        Me.Cursor = Cursors.WaitCursor

        Dim WhereClause As String = ""

        If cmbDept.SelectedValue <> 0 Then
            If WhereClause.Trim <> "" Then
                WhereClause += " and Group1Code=" & cmbDept.SelectedValue
            Else
                WhereClause = " Group1Code=" & cmbDept.SelectedValue
            End If
        End If
        If cmbBrand.SelectedValue <> 0 Then
            If WhereClause.Trim <> "" Then
                WhereClause += " and Group2Code=" & cmbBrand.SelectedValue
            Else
                WhereClause += " Group2Code=" & cmbBrand.SelectedValue
            End If
        End If
        If cmbManuf.SelectedValue <> 0 Then
            If WhereClause.Trim <> "" Then
                WhereClause += " and Group3Code=" & cmbManuf.SelectedValue
            Else
                WhereClause += " Group3Code=" & cmbManuf.SelectedValue
            End If
        End If
        If cmbCate.SelectedValue <> 0 Then
            If WhereClause.Trim <> "" Then
                WhereClause += " and Group4Code=" & cmbCate.SelectedValue
            Else
                WhereClause += " Group4Code=" & cmbCate.SelectedValue
            End If
        End If
        If cmbSubCate.SelectedValue <> 0 Then
            If WhereClause.Trim <> "" Then
                WhereClause += " and Group5Code=" & cmbSubCate.SelectedValue
            Else
                WhereClause += " Group5Code=" & cmbSubCate.SelectedValue
            End If
        End If
        Dim ICdata As New ICdataLogic

        Dim ds As DataSet
        ds = ICdata.GetRetailProductSaleList(cmbShowroom.SelectedValue, tbFromDate.Text, tbToDate.Text, WhereClause)
        '
        Dim TotQty, TotGross, TotDisc, TotNet As Double
        Dim TotLines As Integer
        Dim dRow As DataRow
        For Each dRow In ds.Tables(0).Rows
            TotLines += 1
            'Select Case dRow("InvType")
            '    Case "S"
            '        TotQty += dRow("InvQty")
            '        TotGross += dRow("InvPrice")
            '        TotDisc += dRow("InvDisa")
            '        TotNet += dRow("InvLtot")
            '    Case "R"
            '        TotQty -= dRow("InvQty")
            '        TotGross -= dRow("InvPrice")
            '        TotDisc -= dRow("InvDisa")
            '        TotNet -= dRow("InvLtot")
            'End Select
            TotQty += dRow("InvQty")
            TotGross += dRow("InvPrice")
            TotDisc += dRow("InvDisa")
            TotNet += dRow("InvLtot")

            dRow("InvQty") = CDbl(dRow("InvQty")).ToString("#,##0")
            If CDbl(dRow("InvPrice")) <> 0 Then
                dRow("InvPrice") = CDbl(dRow("InvPrice")).ToString("#,##0.000")
            Else
                dRow("InvPrice") = System.DBNull.Value
            End If
            If CDbl(dRow("InvDisa")) <> 0 Then
                dRow("InvDisa") = CDbl(dRow("InvDisa")).ToString("#,##0.000")
            Else
                dRow("InvDisa") = System.DBNull.Value
            End If
            If CDbl(dRow("InvLtot")) <> 0 Then
                dRow("InvLtot") = CDbl(dRow("InvLtot")).ToString("#,##0.000")
            Else
                dRow("InvLtot") = System.DBNull.Value
            End If
        Next
        '
        dRow = ds.Tables(0).NewRow()
        dRow("DepartmentName") = "TOTAL:"
        dRow("InvQty") = TotQty.ToString("#,##0")
        dRow("InvPrice") = TotGross.ToString("#,##0.000")
        dRow("InvDisa") = TotDisc.ToString("#,##0.000")
        dRow("InvLtot") = TotNet.ToString("#,##0.000")
        ds.Tables(0).Rows.Add(dRow)
        tbTqty.Text = TotQty.ToString("###0")
        tbTsale.Text = TotGross.ToString("###0.000")
        tbTdis.Text = TotDisc.ToString("###0.000")
        tbTNet.Text = TotNet.ToString("###0.000")

        dgProduct.DataSource = ds.Tables(0)
        With dgProduct
            ' .BackgroundColor = GridBackgroundColor
            .TableStyles.Clear()
            .CaptionBackColor = System.Drawing.Color.SlateBlue
            .CaptionForeColor = System.Drawing.Color.LemonChiffon
            .AllowSorting = True
            .AlternatingBackColor = System.Drawing.Color.AliceBlue
            .ParentRowsBackColor = System.Drawing.Color.Lavender
            .ParentRowsForeColor = System.Drawing.Color.SlateBlue
            .HeaderBackColor = System.Drawing.Color.LemonChiffon
            .AllowNavigation = False
            .ParentRowsVisible = False
            .RowHeadersVisible = False
        End With
        Dim cm As CurrencyManager = BindingContext(dgProduct.DataSource, dgProduct.DataMember)
        Dim dv As DataView = cm.List
        dv.AllowNew = False
        dgformat(ds.Tables(0).Rows.Count)
        ICdata = Nothing
        Me.Cursor = Cursors.Default

    End Sub
    Private Sub dgformat(ByVal RowCount As Integer)
        Dim grdTableStyle As New DataGridTableStyle
        With grdTableStyle
            .AlternatingBackColor = Color.AliceBlue
            .HeaderFont = New Font("Tahoma", 8.0!, FontStyle.Bold)
            .MappingName = "INVOICE"
            .PreferredColumnWidth = 160
            .HeaderBackColor = Color.LightSlateGray
            .HeaderForeColor = Color.LightCyan
            .PreferredRowHeight = 15
            .RowHeadersVisible = False
            .RowHeaderWidth = 0
        End With
        Dim cs1 As DataGridColumnStyle
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 0
        cs1.MappingName = "INVID"
        cs1.HeaderText = "ID"
        cs1.NullText = ""
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 120
        cs1.MappingName = "INVNO"
        cs1.HeaderText = "INVOICE"
        cs1.NullText = ""
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 120
        cs1.MappingName = "DEPARTMENTNAME"
        cs1.HeaderText = "SR/CR"
        cs1.NullText = ""
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 110
        cs1.MappingName = "INVBARCODE"
        cs1.HeaderText = "BARCODE"
        cs1.NullText = ""
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 220
        cs1.MappingName = "INVDESC"
        cs1.HeaderText = "DESCRIPTION"
        cs1.NullText = ""
        cs1.ReadOnly = True
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 95
        cs1.MappingName = "INVQTY"
        cs1.HeaderText = "QTY"
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 95
        cs1.MappingName = "INVPRICE"
        cs1.HeaderText = "GROSS AMT"
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 90
        cs1.MappingName = "INVDISA"
        cs1.HeaderText = "DIS.AMT"
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)
        '
        cs1 = New DataGridTextBoxColumn
        cs1.Width = 110
        cs1.MappingName = "INVLTOT"
        cs1.HeaderText = "NET AMT"
        cs1.NullText = ""
        cs1.ReadOnly = True
        cs1.Alignment = HorizontalAlignment.Right
        grdTableStyle.GridColumnStyles.Add(cs1)

        dgProduct.TableStyles.Add(grdTableStyle)
    End Sub

    Private Sub cmbCompany_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs)
        LoadGroupCombos(CompanyID)
    End Sub

    Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
        Me.Close()
    End Sub
    Private Sub cmbYear_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbYear.SelectedIndexChanged
        If IsNumeric(cmbYear.Text) Then
            lblpYear.Text = (CInt(cmbYear.Text) - 1).ToString()
            rbDate.PerformClick()
        End If
    End Sub
    Private Sub rbUTD_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbUTD.Click
        tbFromDate.Text = "01/05/" & (cmbYear.Text - 1).ToString()
        tbToDate.Text = "30/04/" & cmbYear.Text
        If Today() < DateTime.Parse(tbToDate.Text) Then
            tbToDate.Text = Today.ToShortDateString()
        End If
        cmdRefresh.PerformClick()
    End Sub
    Private Sub rbToday_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbToday.Click
        tbFromDate.Text = Now.Today().ToShortDateString()
        tbToDate.Text = Now.Today().ToShortDateString()
        cmdRefresh.PerformClick()
    End Sub
    Private Sub rbWeek_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbWeek.Click
        tbFromDate.Text = Now.Today().AddDays(0 - (Now.Today().DayOfWeek() + 1))
        tbToDate.Text = DateTime.Parse(tbFromDate.Text).AddDays(6)
        cmdRefresh.PerformClick()
    End Sub
    Private Sub rbMonth_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbMonth.Click
        tbFromDate.Text = "01/" & Now.Today.Month() & "/" & Now.Today.Year
        tbToDate.Text = Today.DaysInMonth(Today.Year, Today.Month) & "/" & Today.Month & "/" & Today.Year
        cmdRefresh.PerformClick()
    End Sub
    Private Sub SetFromDate(ByVal mMonth As Integer, ByVal mYear As Integer)
        tbFromDate.Text = "01/" & mMonth & "/" & mYear
    End Sub
    Private Sub SetToDate(ByVal mMonth As Integer, ByVal mYear As Integer)
        tbToDate.Text = Today.DaysInMonth(mYear, mMonth) & "/" & mMonth & "/" & mYear
    End Sub
    Private Sub rbMonth5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbMonth5.Click
        SetFromDate(5, lblpYear.Text)
        SetToDate(5, lblpYear.Text)
        cmdRefresh.PerformClick()
    End Sub
    Private Sub rbMonth6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbMonth6.Click
        SetFromDate(6, lblpYear.Text)
        SetToDate(6, lblpYear.Text)
        cmdRefresh.PerformClick()
    End Sub

    Private Sub rbMonth7_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbMonth7.Click
        SetFromDate(7, lblpYear.Text)
        SetToDate(7, lblpYear.Text)
        cmdRefresh.PerformClick()
    End Sub

    Private Sub rbMonth8_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbMonth8.Click
        SetFromDate(8, lblpYear.Text)
        SetToDate(8, lblpYear.Text)
        cmdRefresh.PerformClick()
    End Sub

    Private Sub rbMonth9_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbMonth9.Click
        SetFromDate(9, lblpYear.Text)
        SetToDate(9, lblpYear.Text)
        cmdRefresh.PerformClick()
    End Sub

    Private Sub rbMonth10_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbMonth10.Click
        SetFromDate(10, lblpYear.Text)
        SetToDate(10, lblpYear.Text)
        cmdRefresh.PerformClick()
    End Sub

    Private Sub rbMonth11_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbMonth11.Click
        SetFromDate(11, lblpYear.Text)
        SetToDate(11, lblpYear.Text)
        cmdRefresh.PerformClick()
    End Sub

    Private Sub rbMonth12_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbMonth12.Click
        SetFromDate(12, lblpYear.Text)
        SetToDate(12, lblpYear.Text)
        cmdRefresh.PerformClick()
    End Sub

    Private Sub rbMonth1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbMonth1.Click
        SetFromDate(1, cmbYear.Text)
        SetToDate(1, cmbYear.Text)
        cmdRefresh.PerformClick()
    End Sub

    Private Sub rbMonth2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbMonth2.Click
        SetFromDate(2, cmbYear.Text)
        SetToDate(2, cmbYear.Text)
        cmdRefresh.PerformClick()
    End Sub

    Private Sub rbMonth3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbMonth3.Click
        SetFromDate(3, cmbYear.Text)
        SetToDate(3, cmbYear.Text)
        cmdRefresh.PerformClick()
    End Sub

    Private Sub rbMonth4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbMonth4.Click
        SetFromDate(4, cmbYear.Text)
        SetToDate(4, cmbYear.Text)
        cmdRefresh.PerformClick()
    End Sub

    Private Sub dgProduct_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dgProduct.MouseUp
        Dim pt As New Point(e.X, e.Y)
        Dim hti As DataGrid.HitTestInfo = dgProduct.HitTest(pt)
        If hti.Type = DataGrid.HitTestType.Cell Then
            dgProduct.CurrentCell = New DataGridCell(hti.Row, hti.Column)
            dgProduct.Select(hti.Row)
        End If
    End Sub
    Private Sub cmdPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrint.Click

        Me.Cursor = Cursors.WaitCursor

        Dim ds As DataSet = New DataSet("SerpsRpt")
        Dim table As DataTable = New DataTable("SerpsRpt")
        table.Columns.Add("Str1")
        table.Columns.Add("Str2")
        table.Columns.Add("Str3")
        table.Columns.Add("Str4")
        table.Columns.Add("Str5")
        table.Columns.Add("Str6")
        table.Columns.Add("Str7")
        table.Columns.Add("Str8")
        table.Columns.Add("Str9")
        table.Columns.Add("Str10")
        table.Columns.Add("Int1")
        table.Columns.Add("Int2")
        table.Columns.Add("Int3")
        table.Columns.Add("Int4")
        table.Columns.Add("Int5")
        table.Columns.Add("Int6")
        table.Columns.Add("Int7")
        table.Columns.Add("Int8")
        table.Columns.Add("Int9")
        table.Columns.Add("Int10")
        table.Columns.Add("Dec1")
        table.Columns.Add("Dec2")
        table.Columns.Add("Dec3")
        table.Columns.Add("Dec4")
        table.Columns.Add("Dec5")
        table.Columns.Add("Dec6")
        table.Columns.Add("Dec7")
        table.Columns.Add("Dec8")
        table.Columns.Add("Dec9")
        table.Columns.Add("Dec10")

        Dim indate As String

        Dim mrow, drow As Integer
        Dim cm As CurrencyManager = BindingContext(dgProduct.DataSource, dgProduct.DataMember)
        Dim dv As DataView = cm.List
        dv.RowStateFilter = DataViewRowState.CurrentRows
        'If dv.Count = 0 Then
        '    btnRefresh.PerformClick()
        'End If
        mrow = dv.Count
        Dim n As Integer
        For n = 0 To mrow - 1
            Dim nrow As DataRow = table.NewRow()
            nrow("Str1") = dgProduct.Item(n, 1)
            nrow("Str2") = dgProduct.Item(n, 2)
            nrow("Str3") = dgProduct.Item(n, 3)
            nrow("Str4") = dgProduct.Item(n, 4)
            nrow("Dec1") = dgProduct.Item(n, 5)
            nrow("Dec2") = dgProduct.Item(n, 6)
            nrow("Dec3") = dgProduct.Item(n, 7)
            nrow("Dec4") = dgProduct.Item(n, 8)
            table.Rows.Add(nrow)
        Next
        ds.Tables.Add(table)

        crICproductSales1.Load()
        crICproductSales1.SetDataSource(ds)

        Dim rptype As String
        rptype = cmbDept.Text + "/" + cmbBrand.Text + "/" + cmbManuf.Text + "/" + cmbCate.Text + "/" + cmbSubCate.Text
        crICproductSales1.SetParameterValue("CompName", CompanyTitle)
        crICproductSales1.SetParameterValue("ReportName", "Sales Details - Retail")
        crICproductSales1.SetParameterValue("FromDate", tbFromDate.Text)
        crICproductSales1.SetParameterValue("ToDate", tbToDate.Text)
        crICproductSales1.SetParameterValue("ShowroomName", cmbShowroom.Text)
        crICproductSales1.SetParameterValue("ReportType", rptype)

        If PrntPrv Is Nothing Then
            PrntPrv = New PrintPreviewForm
            PrntPrv.CrRptView.ReportSource = crICproductSales1
            PrntPrv.ShowDialog()
        End If
        'crICproductSales1.PrintOptions.PrinterName = InvoicePrinter
        'Try
        '    crICproductSales1.PrintToPrinter(1, True, 0, 0)
        'Catch ex As Exception
        '    MsgBox(ex.ToString)
        'End Try
        crICproductSales1.Close()
        Me.Cursor = Cursors.Default
    End Sub

    Private Sub cmbDept_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbDept.SelectedIndexChanged, cmbBrand.SelectedIndexChanged, cmbSubSubCate.SelectedIndexChanged, cmbCate.SelectedIndexChanged, cmbManuf.SelectedIndexChanged, cmbSubCate.SelectedIndexChanged
        If IsNumeric(cmbDept.SelectedValue) Then
            If cmbDept.SelectedValue > 0 Then
                Dim ICdata As New ICdataLogic
                Dim ds As DataSet
                ds = ICdata.GetBrandRelatedGroups(CompanyID, 2, cmbDept.SelectedValue)
                cmbBrand.DataSource = ds.Tables(0)
                cmbBrand.ValueMember = "GroupID"
                cmbBrand.DisplayMember = "GroupName"
                cmbBrand.SelectedValue = 0
                '
                ds = ICdata.GetBrandRelatedGroups(CompanyID, 3, cmbDept.SelectedValue)
                cmbManuf.DataSource = ds.Tables(0)
                cmbManuf.ValueMember = "GroupID"
                cmbManuf.DisplayMember = "GroupName"
                cmbManuf.SelectedValue = 0
                '
                ds = ICdata.GetBrandRelatedGroups(CompanyID, 4, cmbDept.SelectedValue)
                cmbCate.DataSource = ds.Tables(0)
                cmbCate.ValueMember = "GroupID"
                cmbCate.DisplayMember = "GroupName"
                cmbCate.SelectedValue = 0
                '
                ds = ICdata.GetBrandRelatedGroups(CompanyID, 5, cmbDept.SelectedValue)
                cmbSubCate.DataSource = ds.Tables(0)
                cmbSubCate.ValueMember = "GroupID"
                cmbSubCate.DisplayMember = "GroupName"
                cmbSubCate.SelectedValue = 0
                '
                ICdata = Nothing
            End If
        End If
    End Sub

   
End Class
